package com.tt.fashionWebSite.domain;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Created by 10520_000 on 10/28/14.
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "loai_dm")
@NamedQueries({
        @NamedQuery(name = "getLoaiDanhMuc",query = "SELECT u FROM LoaiDanhMucFull u") ,
      @NamedQuery(name = "loaiDanhMucFull.getLoaiDanhMucSupposed",query = "SELECT u FROM LoaiDanhMucFull u WHERE u.maLoai = 'LDM1' OR u.maLoai = 'LDM2' ORDER BY u.maLoai asc ") ,
})
public class LoaiDanhMucFull implements Serializable {
   public static final String GET_LOAI_DANH_MUC = "getLoaiDanhMuc";
   public static final String GET_LOAI_DANH_MUC_SUPPOSED = "loaiDanhMucFull.getLoaiDanhMucSupposed";
   @Id
   @Column(name = "MA_LOAI")
   private String maLoai;

   @Column(name = "TEN_LOAI")
   private String tenLoai;

   @LazyCollection(LazyCollectionOption.FALSE)
   @OneToMany(mappedBy = "loaiDanhMuc", cascade = {CascadeType.ALL}, orphanRemoval = true)
   private List<LoaiDanhMucSanPham> loaiDanhMucSanPham;

   @LazyCollection(LazyCollectionOption.FALSE)
   @OneToMany(mappedBy = "loaiDanhMuc", cascade = {CascadeType.ALL}, orphanRemoval = true)
   private List<KichThuoc> kichThuoc;

   public String getMaLoai() {
      return maLoai;
   }

   public void setMaLoai(String maLoai) {
      this.maLoai = maLoai;
   }

   public String getTenLoai() {
      return tenLoai;
   }

   public void setTenLoai(String tenLoai) {
      this.tenLoai = tenLoai;
   }

   public List<LoaiDanhMucSanPham> getLoaiDanhMucSanPham() {
      return loaiDanhMucSanPham;
   }

   public void setLoaiDanhMucSanPham(List<LoaiDanhMucSanPham> loaiDanhMucSanPham) {
      this.loaiDanhMucSanPham = loaiDanhMucSanPham;
   }

   public List<KichThuoc> getKichThuoc() {
      return kichThuoc;
   }

   public void setKichThuoc(List<KichThuoc> kichThuoc) {
      this.kichThuoc = kichThuoc;
   }
}
